﻿using MES.Core;
using MES.Model.System;

namespace MES.Service.System.User
{
    public class UserService : IUserService
    {
        private readonly IDataBaseService _dataBaseService;
        public UserService(IDataBaseService dataBaseService)
        {
            _dataBaseService = dataBaseService;
        }
        /// <summary>
        /// 添加用户
        /// </summary>
        /// <param name="user"></param>
        /// <returns></returns>
        public async Task<OperateResult> AddUserAsync(Sys_User user)
        {
            var data = await _dataBaseService.sqlSugarClient.Insertable<Sys_User>(user).ExecuteCommandAsync();
            if (data > 0)
            {
                return OperateResult.Success("添加成功");
            }
            else
            {
                return OperateResult.Fail("添加失败");
            }
        }
    }
}
